package aad.storyboard.view;

import java.util.Observable;
import java.util.Observer;

import aad.storyboard.model.Story;
import aad.storyboard.model.StorySettings;
import aad.storyboard.model.menu.MenuItem;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.SeekBar;

//helper method to create switchviews
public class StoryBar extends SeekBar implements Observer{
	
	private Integer tag;
	private StorySettings settings;
	
	
	
	public StoryBar(Context context,AttributeSet as) {
		super(context,as);
		this.settings = Story.getInstance().getSettings();
		this.settings.addObserver(this);
		
	}
	public StoryBar(Context context, Integer t) {
		super(context);
		this.tag = t;
		this.settings = Story.getInstance().getSettings();
		this.settings.addObserver(this);
		
	}
	@Override
	public void update(Observable observable, Object data) {
		if(this.tag.intValue() == MenuItem.VOLUME){
			this.setProgress(settings.getVolume());
		}
		this.invalidate();
	}
	@Override
	public Object getTag(){
		return this.tag;
	}
	
	public void setTag(Integer tag){
		this.tag = tag;
	}
	
	

}
